package com.apestech.framework.db.queryData;

import com.apestech.framework.db.SqlResultSet;
import com.apestech.framework.db.callback.QueryCallBackHandler;
import com.apestech.framework.json.JSONArray;

import java.util.Date;

/**
 * @author hup
 * @create 2018-08-16-16:51
 */
public class QueryDate implements QueryCallBackHandler {
    private Date date;
    private String field;

    public QueryDate(String field){
        this.field=field;
    }

    @Override
    public void getData(SqlResultSet rs, JSONArray rslist) throws Exception {
        date=null;
        if(rs.next()) {
            date=new Date(rs.getTimestamp(field).getTime());
        }
    }

    public Date getDate() {
        return date;
    }
}
